#include <iostream>
#include <string>
using namespace std;

int main() (
    string a, b, c;
    int a1, b1, c1;
    cin >> a >> b >> c;
    if (a == "one")
        a1 = 1 * 100;
    else if (a == "two")
        a1 = 2 * 100;
    else if (a == "three")
        a1 = 3 * 100;
    else if (a == "four")
        a1 = 4 * 100;
    else if (a == "five")
        a1 = 5 * 100;
    else if (a == "six")
        a1 = 6 * 100;
    else if (a == "seven")
        a1 = 7 * 100;
    else if (a == "eight")
        a1 = 8 * 100;
    else if (a == "nine")
        a1 = 9 * 100;
    else if (a == "zero")
        a1 = 0 * 100;
        
    if (b == "one")
        b1 = 1 * 10;
    else if (b == "two")
        b1 = 2 * 10;
    else if (b == "three")
        b1 = 3 * 10;
    else if (b == "four")
        b1 = 4 * 10;
    else if (b == "five")
        b1 = 5 * 10;
    else if (b == "six")
        b1 = 6 * 10;
    else if (b == "seven")
        b1 = 7 * 10;
    else if (b == "eight")
        b1 = 8 * 10;
    else if (b == "nine")
        b1 = 9 * 10;
    else if (b == "zero")
        b1 = 0 * 10;

      if (c == "one")
        c1 = 1;
    else if (c == "two")
        c1 = 2;
    else if (c == "three")
        c1 = 3;
    else if (c == "four")
        c1 = 4;
    else if (c == "five")
        c1 = 5;
    else if (c == "six")
        c1 = 6;
    else if (c == "seven")
        c1 = 7;
    else if (c == "eight")
        c1 = 8;
    else if (c == "nine")
        c1 = 9;
    else if (c == "zero")
        c1 = 0;

    int x = a1 + b1 + c1;
    
    int cout = 0; 
    for (int i = 1; i < x + 1; i++)
        if (x % i == 0)
            count++;
    if (count == 2)
        cout << x;
    else  {
        int k_right1, k_left1;
        for (int k_right = x+1; k_right < 10000; k_right++) {
            count = 0;
            for (int i = 1; i < k_right + 1; i++)
                if k_right % i == 0)
                    count ++; 
            if (count == 2) {
                k_right1 = k_right;
                break;
            }
        }
